<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>use nth fragment with sibling selector</title>
    <style>
        @page {
            size: 820px;
        }
        @-epubx-page-template {
            .partition {
                width: 398px;
                height: 198px;
                border: rgba(0, 0, 255, 0.2) solid 1px;
                -epubx-flow-from: body;
            }
            .left {
                left: 10px;
            }
            .right {
                right: 10px;
            }

            @-epubx-page-master {
                @-epubx-partition {
                    bottom: 0;
                    left: 0;
                    right: 0;
                    height: 10px;
                    font-size: 10px;
                    line-height: 10px;
                    text-align: center;
                    content: counter(page);
                }
                @-epubx-partition class(partition) class(right) {
                    top: 610px;
                }
                @-epubx-partition class(partition) class(right) {
                    top: 410px;
                }
                @-epubx-partition class(partition) class(right) {
                    top: 210px;
                }
                @-epubx-partition class(partition) class(right) {
                    top: 10px;
                }
                @-epubx-partition class(partition) class(left) {
                    top: 610px;
                }
                @-epubx-partition class(partition) class(left) {
                    top: 410px;
                }
                @-epubx-partition class(partition) class(left) {
                    top: 210px;
                }
                @-epubx-partition class(partition) class(left) {
                    top: 10px;
                }
            }
        }
        :root {
            font-size: 14px;
            line-height: 12px;
            widows: 1;
            orphans: 1;
        }
        body {
            margin: 0 10px;
        }

        div.content {
          height: 40px;
          padding: 10px
        }

        section {
          border: 1px solid #999;
          padding: 5px;
          margin: 5px
        }
        section + span::after {
          content: "This text should not be displayed.";
          color: red;
          padding: 5px;
          margin:  5px
        }

        section::nth-fragment(1) + span::after {
          content: "↑ this block spans 1 fragments";
        }
        section::nth-fragment(2) + span::after {
          content: "↑ this block spans 2 fragments";
        }
        section::nth-fragment(3) + span::after {
          content: "↑ this block spans 3 fragments";
        }

        section::nth-fragment(2) ~ span::after {
          color: blue;
        }

    </style>
</head>
<body>
  <section>
    <div class="content">a</div>
  </section>
  <span></span>
  <section>
    <div class="content">c</div>
    <div class="content">d</div>
  </section>
  <span></span>
  <section>
    <div class="content">h</div>
    <div class="content">i</div>
    <div class="content">j</div>
    <div class="content">k</div>
    <div class="content">l</div>
    <div class="content">m</div>
  </section>
  <span></span>
</body>
</html>
